<!-- PdfViewer.vue -->
<template>
    <div style="height: 100vh; margin: 0;">
        <iframe :src="pdfUrl" width="100%" height="100%" style="border: none;" title="PDF预览"></iframe>
    </div>
</template>

<script>
export default {
    name: 'PdfViewer',
    data() {
        return {
            pdfUrl: ''
        }
    },
    created() {
        // 从路由参数里拿 url
        this.pdfUrl = `/pdfjs/web/viewer.html?file=${encodeURIComponent(this.$route.query.url)}`
    },
    computed: {
        viewerUrl() {
            //   return this.$route.query.url
            return `https://mozilla.github.io/pdf.js/web/viewer.html?file=${encodeURIComponent(this.$route.query.url)}&origin=*`
            
        }
    }
}
</script>